/********************************************************************
	Created:	2011/02/22    10:06 
	Filename: 	EventTarget.h
	Author:		falconwang
*********************************************************************/

#ifndef EventTarget_H__
#define EventTarget_H__

#include <map>
#include <list>
#include <string>

#include "EWrapper.h"

namespace ES
{	
	class EventListener;
	
	class EventTarget
	{
	public:

		EventTarget(void);
		virtual ~EventTarget(void);

		void	AddEventListener(const std::string& _eType , EventListener* _listener);

		void	RemoveEventListener(const std::string& _eType , EventListener* _listener);

		bool	HasEventListener(const std::string& _eType) const;

		void	DispatchEvent(Event& _e);

		void	HandleDestroyEventListener();

		void	RemoveAllEventListeners();

	private:
		std::map<std::string , std::list<EL_Ptr> >    m_Listners ;
	};

}
#endif // EventTarget_H__
